from StartGroup.models import Group
from groupInfo.models import Info
from django import forms
from django.conf import settings
from django import forms
import datetime

attrs_dict = { 'class': 'required' }

class GroupInfoForm(forms.Form):
    
    info_head = forms.CharField(max_length=200, required=False, label='Header Information (Information will appear on top in bold text):',
                                 widget=forms.Textarea(attrs={'size':'200', 'cols':'100', 'rows':'2', 'id':'id_info_head'}))
    info = forms.CharField(max_length=1000, required=False, label='Information:',
                                 widget=forms.Textarea(attrs={'size':'1000', 'cols':'100', 'rows':'10', 'id':'id_info'}))
    contact_info = forms.CharField(max_length=300, required=False, label='Contact Information:',
                                 widget=forms.Textarea(attrs={'size':'300', 'cols':'50', 'rows':'6', 'id':'id_contact_info'}))
    locations_info = forms.CharField(max_length=300, required=False, label='Locations:',
                                 widget=forms.Textarea(attrs={'size':'300', 'cols':'50', 'rows':'6', 'id': 'id_locations_info'}))
    
    def save(self, group_info):
        group_information = Info(group = group_info,
                                info_head=self.cleaned_data['info_head'],
                                info=self.cleaned_data['info'],
                                contact_info=self.cleaned_data['contact_info'],
                                locations_info=self.cleaned_data['locations_info'],
                                )
        group_information.save(force_update = True)
        return group_information